﻿//程序开始时间
DateTime Time1 = DateTime.Now;
//从大到小循环
for (int i = 99999; i >= 0; i--)
{
    if (i % 2 == 0) continue;
    //利用平方根判断是否为质数，如果不是进行下一次循环
    for (int j = 2; j < Math.Sqrt(i); j++)
    {
        if (i % j == 0)
            goto nextstep;
    }
    Console.WriteLine(i);
    break;
nextstep:;
}
//计算时间差
DateTime Time2 = DateTime.Now;
TimeSpan Time3 = Time2 - Time1;
int Milliseconds = Time3.Milliseconds;
Console.WriteLine("程序运行时间为" + Milliseconds + "毫秒");